package com.ykdl.member.kid.util;

import java.util.ArrayList;
import java.util.List;

import com.ykdl.member.kid.beans.OnLineCouponBean;
import com.ykdl.member.kid.beans.TicketBean;

public class DisposalListUtils {
	
	public static final int TITLE_ONE = 0;
	public static final int TITLE_TWO = 1;
	public static final int ON_LINE_COUPON = 2;
	public static final int UN_LINE_COUPON = 3;
	
	public static final int NO_ON_LINE_COUPON = 4;//没有
	public static final int NO_UN_LINE_COUPON = 5;//没有
	
	
	public static DisposalListUtils getInstance(){
		return new DisposalListUtils();
	}
	
	public  List<ItemBean> disposalStoreAndCouponList_old(List<OnLineCouponBean> mOnLineList,List<TicketBean> mOffLineList){
		List<ItemBean> mData = new ArrayList<ItemBean>();
		//标题1
		mData.add(getInfo(0));
		//在线支付可用优惠券
		if (mOnLineList!=null&&mOnLineList.size()>0) {
			for (int i = 0; i < mOnLineList.size(); i++) {
				
				mData.add(getInfo(2, i));
			}
		}else {
			mData.add(getInfo(4));
		}
		
		//标题2
		mData.add(getInfo(1));
		//到店支付可用优惠券
		if (mOffLineList!=null&&mOffLineList.size()>0) {
			for (int i = 0; i < mOffLineList.size(); i++) {
				
				mData.add(getInfo(3, i));
			}
		}else {
			mData.add(getInfo(5));
		}
		
		
		return mData;
		
	}
	public  List<ItemBean> disposalStoreAndCouponList(List<OnLineCouponBean> mOnLineList,List<TicketBean> mOffLineList){
		List<ItemBean> mData = new ArrayList<ItemBean>();
		//标题1 -----需要判断是否有优惠券
		
		if (mOnLineList!=null&&mOnLineList.size()>0) {
			for (int i = 0; i < mOnLineList.size(); i++) {
				
			}
			mData.add(getInfo(TITLE_ONE,true));
		}else {
			mData.add(getInfo(TITLE_ONE,false));
		}
		//在线支付可用优惠券
		if (mOnLineList!=null&&mOnLineList.size()>0) {
			for (int i = 0; i < mOnLineList.size(); i++) {
				
				mData.add(getInfo(ON_LINE_COUPON, i));
			}
		}else {
			//mData.add(getInfo(4));
		}
		
		//标题2
		
		if (mOffLineList!=null&&mOffLineList.size()>0) {
			for (int i = 0; i < mOffLineList.size(); i++) {
				
			}
			mData.add(getInfo(TITLE_TWO,true));
		}else {
			mData.add(getInfo(TITLE_TWO,false));
		}
		//到店支付可用优惠券
		if (mOffLineList!=null&&mOffLineList.size()>0) {
			for (int i = 0; i < mOffLineList.size(); i++) {
				
				mData.add(getInfo(UN_LINE_COUPON, i));
			}
		}else {
			//mData.add(getInfo(5));
		}
		
		
		return mData;
		
	}
	
	
	
	
	/**
	 * 
	 *item_choose 应该返回什么Item
	 *position 内部的Position
	 */
	public class ItemBean{
		public ItemBean(int number) {
			item_choose = number;
		}
		public ItemBean(int number,boolean flag) {
			item_choose = number;
			isHaveCoupon = flag;
		}
		public ItemBean(int number,int position) {
			item_choose = number;
			this.position = position;
		}
		
		public int item_choose;
		public int position;
		public boolean isHaveCoupon = false;
	}
	
	private ItemBean getInfo(int number){
		return new ItemBean(number);
	}
	private ItemBean getInfo(int number,boolean flag){
		return new ItemBean(number,flag);
	}
	
	private ItemBean getInfo(int number,int position){
		return new ItemBean(number,position);
	}
	
	
}
